package com.lgh.hotel.controller;

import com.lgh.hotel.dao.pojo.GuestTemp;
import com.lgh.hotel.service.TempServer;
import com.lgh.hotel.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.Map;

@Api(tags = "体温模块")
@RestController
@RequestMapping("temp")
public class TempController {
    @Autowired
    TempServer tempServer;

    @ApiOperation(value = "提报")
    @PostMapping("/setTemp")
    public Result temp(@RequestBody Map params) {
        return Result.succ(tempServer.tempToUser());
    }

    @ApiOperation(value = "insert")
    @PostMapping("/insert")
    public Result insert(@RequestBody GuestTemp params) {

        params.setTempTime(new Date());
        tempServer.save(params);
        return Result.succ();
    }

    @ApiOperation(value = "update")
    @PostMapping("/update")
    public Result update(@RequestBody GuestTemp params) {
        params.setHsTime(new Date());
        tempServer.updateById(params);
        return Result.succ();
    }



    @ApiOperation(value = "select")
    @PostMapping("/select")
    public Result select(@RequestBody GuestTemp params) {
        return Result.succ(tempServer.select(params));
    }


}
